package com.xin.springcloudconsumer.feigns;

import com.xin.springcloudconsumer.form.UserForm;
import com.xin.springcloudconsumer.vo.ResultVO;
import org.apache.http.HttpRequest;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient("springcloud-user")
public interface UserFeign {
    /**
     * 创建用户(openId需要在参数中传递进来)
     * @param userForm
     * @return
     */
    @RequestMapping(value = "/create",method = RequestMethod.POST)  //required 是否为必传
    public ResultVO create(@RequestBody(required = false)UserForm userForm);


    /**
     * 更新用户
     * @param userForm
     * @return
     */
    @RequestMapping(value = "/update",method = RequestMethod.POST)
    public ResultVO update(@RequestBody(required = false) UserForm userForm);

    /**
     * 删除用户
     * @param uid
     * @return
     */
    @RequestMapping(value = "/delete",method = RequestMethod.GET)
    public ResultVO delete(@RequestParam(name = "uid",defaultValue = "") String uid);
    /**
     * 根据用户Id查询用户
     * @param uid
     * @return
     */
    @GetMapping("/findOneByUserId")
    public ResultVO findOneByUserId(@RequestParam(name = "uid",defaultValue = "") String uid);

    /**
     * 根据openId查询用户
     * @param openId
     * @return
     */
    @GetMapping("/findOneByOpenId")
    public ResultVO findOneByOpenId(@RequestParam(name = "openId",defaultValue = "") String openId);


}
